<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script src="https://unpkg.com/vue@3/dist/vue.global.js"></script>
    <div id="app">
        用户名： <input type="text" v-model="username"><br>
        密 码: <input type="text" v-model.number="password"><br>
        <button type="submit" @click="login">登录</button>
        <button type="reset" @click="reset">重置</button>
    </div>
    <script>
        const { createApp } = Vue
        createApp({
            data() {
                return {
                    username: '',
                    password: '',
                }
            },
            methods: {
                login() {
                    if (this.username == 'admin' && this.password == '123456') {
                        alert('登录成功')
                    } else {
                        alert('登录失败')
                    }
                },
                reset() {
                    this.username = ''
                    this.password = ''
                }
            }
        }).mount('#app')
    </script>
</body>

</html>